package com.struts2.util;

import java.util.List;

public class Page {
	private int pageNo; 
	private int totalPage;
	private int pageSize;
	private int totalNum;
	private List list;
	public Page(){
		this.pageNo = 1;
		this.pageSize = 2;
	}
	public Page(int pageNo, int pageSize) {
		this.pageNo = pageNo;
		this.pageSize = pageSize;
		if(pageNo<=0){
			this.pageNo = 1;
		}
		if(pageSize<=0){
			this.pageSize = 2;
		}
	}
	public int getPageNo() {
		return pageNo;
	}
	public void setPageNo(int pageNo) {
		if(pageNo<=0){
			pageNo = 1;
		}
		this.pageNo = pageNo;
	}
	public int getTotalPage() {
		return totalPage;
	}
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		if(pageSize<=0){
			pageSize = 2;
		}
		this.pageSize = pageSize;
	}
	public int getTotalNum() {
		return totalNum;
	}
	public void setTotalNum(int totalNum) {
		if(totalNum>0){
			int remainder = totalNum%pageSize;
			if(remainder==0){
				this.totalPage = totalNum/this.pageSize;
			}else{
				this.totalPage = totalNum/this.pageSize+1;
			}
		}else{
			this.totalPage = 0;
		}
		this.totalNum = totalNum;
	}
	public List getList() {
		return list;
	}
	public void setList(List list) {
		this.list = list;
	}
	
	
}
